<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');

/**
 * Contao Open Source CMS
 * Copyright (C) 2005-2010 Leo Feyer
 *
 * Formerly known as TYPOlight Open Source CMS.
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program. If not, please visit the Free
 * Software Foundation website at <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 * @copyright  certo web & design GmbH 2011 
 * @author     Yanick Witschi <yanick.witschi@certo-net.ch> 
 * @package    rapidmail_sync_recipients 
 * @license    LGPL
 * @filesource
 */


/**
 * Table tl_newsletter_channel 
 */

// add "operation" 
$GLOBALS['TL_DCA']['tl_newsletter_channel']['list']['operations']['rm_sync_recipients_module_state'] = array
(
  'button_callback'     => array('RapidmailRecipientsSynchronizer', 'getModuleState')
);

// replace palette
$GLOBALS['TL_DCA']['tl_newsletter_channel']['palettes']['default'] = str_replace('useSMTP','useSMTP;{rm_sync_recipients_legend},rm_sync_recipients_activate;',$GLOBALS['TL_DCA']['tl_newsletter_channel']['palettes']['default']);

// extend selector
$GLOBALS['TL_DCA']['tl_newsletter_channel']['palettes']['__selector__'][] = 'rm_sync_recipients_activate';

// extend subpalette
$GLOBALS['TL_DCA']['tl_newsletter_channel']['subpalettes']['rm_sync_recipients_activate'] = 'rm_sync_recipients_list_id,rm_sync_recipients_node_id,rm_sync_recipients_auth_key,rm_sync_recipients_inform_error_mail';

// add fields
$GLOBALS['TL_DCA']['tl_newsletter_channel']['fields']['rm_sync_recipients_activate'] = array
(
  'label'                   => &$GLOBALS['TL_LANG']['tl_newsletter_channel']['rm_sync_recipients_activate'],
  'exclude'                 => true,
  'inputType'               => 'checkbox',
  'eval'                    => array('submitOnChange'=>true)
);
$GLOBALS['TL_DCA']['tl_newsletter_channel']['fields']['rm_sync_recipients_list_id'] = array
(
  'label'                   => &$GLOBALS['TL_LANG']['tl_newsletter_channel']['rm_sync_recipients_list_id'],
  'exclude'                 => true,
  'inputType'               => 'text',
  'eval'                    => array('mandatory'=>true, 'maxlength'=>10, 'rgxp'=>'digit', 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_newsletter_channel']['fields']['rm_sync_recipients_node_id'] = array
(
  'label'                   => &$GLOBALS['TL_LANG']['tl_newsletter_channel']['rm_sync_recipients_node_id'],
  'exclude'                 => true,
  'inputType'               => 'text',
  'eval'                    => array('mandatory'=>true, 'maxlength'=>10, 'rgxp'=>'digit', 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_newsletter_channel']['fields']['rm_sync_recipients_auth_key'] = array
(
  'label'                   => &$GLOBALS['TL_LANG']['tl_newsletter_channel']['rm_sync_recipients_auth_key'],
  'exclude'                 => true,
  'inputType'               => 'text',
  'eval'                    => array('mandatory'=>true, 'maxlength'=>32, 'encrypt'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_newsletter_channel']['fields']['rm_sync_recipients_inform_error_mail'] = array
(
  'label'                   => &$GLOBALS['TL_LANG']['tl_newsletter_channel']['rm_sync_recipients_inform_error_mail'],
  'exclude'                 => true,
  'inputType'               => 'text',
  'eval'                    => array('helpwizard'=>true, 'maxlength'=>255, 'rgxp'=>'email', 'tl_class'=>'w50'),
  'explanation'             => 'rm_sync_recipients_inform_error_mail'
);
?>